<%= form_for(@user) do |f| %>
    <% if @user.errors.any? %>
        <div id="error_explanation">
          <h2><%= pluralize(@user.errors.count, "error") %> prohibited this shipper from being saved:</h2>

          <ul>
            <% @user.errors.full_messages.each do |msg| %>
                <li><%= msg %></li>
            <% end %>
          </ul>
        </div>
    <% end %>

    <table class="edit_table">
      <tr>
        <td style="width: 50px"><%= f.label(t 'activerecord.attributes.user.login') %></td>
        <td><%= f.text_field :login %>&nbsp;* &nbsp;
          <div id="user_login_msg" class="inline-block"><%= @user.diy_error_msg :login %></div>
        </td>
      </tr>
      <% if sys_admin? %>
          <tr>
            <td><%= f.label(t 'activerecord.attributes.user.biz_unit') %></td>
            <td><%= f.select :biz_unit_id, BizUnit.all.collect { |biz_unit| [biz_unit.name, biz_unit.id] }, :style => "width:152px;" %></td>
          </tr>
      <% elsif biz_unit_admin? %>
          <%= f.hidden_field :biz_unit_id, :value => current_user.biz_unit_id %>
      <% end %>
      <% if sys_admin? %>
          <tr>
            <td><%= f.label(t 'activerecord.attributes.user.role') %></td>
            <td><%= f.select :role_id, Role.all.collect { |role| [role.name, role.id] }, :style => "width:152px;" %></td>
          </tr>
      <% elsif biz_unit_admin? %>
          <%#   code后多0是个人开发规定，系统规定公司管理员的code比普通员工code少一个0，如20（管理员），200（普通用户）       %>
          <%= f.hidden_field :role_id, :value => Role.find_by_code(current_user.role.code+"0").id %>
      <% end %>
      <tr>
        <td><%= f.label(t 'activerecord.attributes.user.email') %></td>
        <td><%= f.text_field :email %>&nbsp;* &nbsp;
          <div id="user_email_msg" class="inline-block"><%= @user.diy_error_msg :email %></div>
        </td>
      </tr>
      <tr>
        <td><%= f.label(t 'activerecord.attributes.user.password') %></td>
        <td><%= f.password_field :password %>&nbsp;* &nbsp;
          <div id="user_password_msg" class="inline-block"><%= @user.diy_error_msg :password %></div>
        </td>
      </tr>
      <tr>
        <td><%= f.label(t 'activerecord.attributes.user.password_confirmation') %></td>
        <td><%= f.password_field :password_confirmation %>&nbsp;* &nbsp;
          <div id="user_password_confirmation_msg" class="inline-block"><%= @user.diy_error_msg :password_confirmation %></div>
        </td>
      </tr>
      <tr>
        <td><%= f.label(t 'activerecord.attributes.user.comment') %></td>
        <td><%= f.text_field :comment %></td>
      </tr>
      <tr>
        <td></td>
        <td>
          <%= link_to (t 'activerecord.attributes.user.confirm'), "#", {:id => "u_n_s", :class => "inline-block s-btn"} %> <!-- s-btn -->
        </td>
      </tr>
    </table>
<% end %>


